<?php
/**
 * Created by PhpStorm.
 * This libraries is used to autoload bean
 *
 * User: xding
 * Date: 15/10/19
 * Time: 下午4:13
 */

class Beanautoloader {

    public function __construct() {
        spl_autoload_register( array($this,'loader') );
    }

    public function loader($class_name) {

        $arr = explode('\\',$class_name);

        if ( 'Beans' === $arr[0] )
        {
            $arr[0] = strtolower($arr[0]);
            $class_name = implode(DIRECTORY_SEPARATOR,$arr);
            require APPPATH . $class_name . '.php';
        }
    }

}